//
//  RefundModel.swift
//  Pods
//
//  Created by eme on 2017/4/25.
//
//

import UIKit
import SwiftyJSON
import ModelProtocol

class RefundModel: ModelProtocol {
    
    // MARK: Declaration for string constants to be used to decode and also serialize.
    internal let kRefundOdateKey: String = "odate"
    internal let kRefundUseridKey: String = "userid"
    internal let kRefundDetailstatusKey: String = "detailstatus"
    internal let kRefundFamountKey: String = "famount"
    internal let kRefundPhoneKey: String = "phone"
    internal let kRefundDetailidKey: String = "detailid"
    internal let kRefundAmountKey: String = "amount"
    internal let kRefundBackremarkKey: String = "backremark"
    internal let kRefundContactKey:String = "contact"
    
    
    // MARK: 属性
    var odate: String
    var userid: String
    var detailstatus: String
    var famount: Int
    var phone: String
    var detailid: String
    var amount: Double
    var backremark: String
    var contact:String
    
    
    // MARK: 实现MikerSwiftJSONAble 协议， 解析json数据
    required  init?(json: JSON) {
        odate = json[kRefundOdateKey].stringValue
        userid = json[kRefundUseridKey].stringValue
        detailstatus = json[kRefundDetailstatusKey].stringValue
        famount = json[kRefundFamountKey].intValue
        phone = json[kRefundPhoneKey].stringValue
        detailid = json[kRefundDetailidKey].stringValue
        amount = json[kRefundAmountKey].doubleValue
        backremark = json[kRefundBackremarkKey].stringValue
        contact = json[kRefundContactKey].stringValue
        
    }
    
    
    /**
     Generates description of the object in the form of a NSDictionary.
     - returns: A Key value pair containing all valid values in the object.
     */
    internal func dictionaryRepresentation() -> [String : AnyObject ] {
        
        var dictionary: [String : AnyObject ] = [ : ]
        
        dictionary.updateValue(odate as AnyObject, forKey: kRefundOdateKey)
    
        dictionary.updateValue(userid as AnyObject, forKey: kRefundUseridKey)
    
        dictionary.updateValue(detailstatus as AnyObject, forKey: kRefundDetailstatusKey)
    
        dictionary.updateValue(famount as AnyObject, forKey: kRefundFamountKey)
    
        dictionary.updateValue(phone as AnyObject, forKey: kRefundPhoneKey)
    
        dictionary.updateValue(detailid as AnyObject, forKey: kRefundDetailidKey)
   
        dictionary.updateValue(amount as AnyObject, forKey: kRefundAmountKey)
    
        dictionary.updateValue(backremark as AnyObject, forKey: kRefundBackremarkKey)
    
        dictionary.updateValue(contact as AnyObject, forKey: kRefundContactKey)
    
        return dictionary
    }
    
    
}
